﻿using System.Collections.Generic;
using System;
using System.Drawing;
using ZedGraph;
using Plotter;

namespace TestPlotter
{
    public partial class graph : System.Web.UI.Page
    {
        protected Plotter.Plotter plotter;
        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }
        private void InitializeComponent()
        {
            List<Curve> curves = new List<Curve>();
            DotTime[] dt = new DotTime[21];
            DotTime[] dt2 = new DotTime[21];
            DateTime t;
            double x;
            int i;
            for (i = 1; i<22; i++)
            {
                t = new DateTime(2009,1,i,5,0,0);
                x = i*i-i;
                dt[i-1] = new Plotter.DotTime(t,x);
            }
            Curve c1 = new Curve("first",dt);
            curves.Add(c1);

            for (i = 1; i < 22; i++)
            {
                t = new DateTime(2009, 1, i, 5, 0, 0);
                x = i * i * i - i;
                dt2[i - 1] = new Plotter.DotTime(t, x);
            }
            Curve c2 = new Curve("second", dt2);
            curves.Add(c2);

            PlotData pd = new PlotData("Тест", curves);

            this.plotter = new Plotter.Plotter(pd);
            this.ZedGraphWeb.RenderGraph += new ZedGraph.Web.ZedGraphWebControlEventHandler(plotter.OnRenderGraph);
        }
        #endregion
    }
}
